const formatTime = date => {
  const year = date.getFullYear()
  const month = date.getMonth() + 1
  const day = date.getDate()
  const hour = date.getHours()
  const minute = date.getMinutes()
  const second = date.getSeconds()

  return `${[year, month, day].map(formatNumber).join('/')} ${[hour, minute, second].map(formatNumber).join(':')}`
}

const formatNumber = n => {
  n = n.toString()
  return n[1] ? n : `0${n}`
}




// 新品上市
function new_Arrival(){
  
   return url1 + '/goods/is_new/1'
}
// 为您推荐
function recommend(){
   return url1
   
}
// 商品性情
 function commodityxq(id){
  console.log(id);
   return url1+'/goods/detail/' +id
    
}
// 轮播
function Homepageby(){

   return url1+'/bannerList'
    
}
// 默认页面
function Thedefaultpage(id){

   return url1 + '/goods/getMenuGoodsList/'+id+'/'+id
}
// 更新用户信息和我的头像
function updatemessage(){
   return url1 + '/saveUser'
}

// 注册
function register(num){
   return url1 + '/oauthUser/'+num
}
// 添加购物车
function addcar(){
   return url1 + '/addcart'
}
// 获取购物车列表
function carlist(){
   return url1 + '/getCartList'
}
// 删除购物车列表
function delecar(id){
   console.log(id);
   return url1 + '/deletecart?id='+id
}
// 获取手机号
function getphon(){
   return url1 + '/getTelPhone'
}

var url1 = 'http://api.pyful.com';
module.exports = {
  formatTime,
  new_Arrival,
  recommend,
  commodityxq,
  Homepageby,
  Thedefaultpage,
  register,
  updatemessage,
  addcar,
  carlist,
  getphon,
  delecar
  
}
